<?php
/**
 * 片段相关接口
 */
class a_block extends CI_Controller {

    function __construct() {
        parent::__construct();
    }

    /**
     * 片段列表
     * @param int $page 当前页数
     * @param int $limit 显示数量
     * @return array 
     */
    function get_block_list_page($page = 1, $limit = 10) {
        $where = array(
            'block.isclose' => 0
        );
        $data = array(
            'from' => 'block',
            'column' => 'block.blockid,block.blockname,block.smallpic,block.description',
            'where' => $where,
            'order' => 'block.listid desc',
        );
        $result = $this->m_public->get_list_page($data, $page, $limit);
        return $result;
    }

    /**
     * 获取单个片段内容
     * @param int $blockid 片段id
     * @return array
     */
    function get_block($blockid) {
        $data = array(
            'blockid' => $blockid,
        );
        $block = $this->m_public->getRowInfo('block', $data);
        return $block;
    }

}
